home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / alaskan-adversary.swf / scripts / frame_150 / PlaceObject3_803_202 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Encoding:
Text File  |  2008-09-11  |  14.6 KB  |  434 lines

  1. onClipEvent(enterFrame){
  2.    _root.char._x += speed;
  3.    bridgeSFX = new Sound(this);
  4.    bridgeSFX.attachSound("bridge");
  5.    if(_root.paus3)
  6.    {
  7.       speed = 0;
  8.       maxspeed = 0;
  9.    }
  10.    if(!_root.paus3)
  11.    {
  12.       grav++;
  13.       _Y = _Y + grav;
  14.       while(_root.ground.hitTest(_X,_Y,true))
  15.       {
  16.          _Y--;
  17.          grav = 0;
  18.       }
  19.       if(this._currentframe != 45)
  20.       {
  21.          if(Key.isDown(_global.rightkey) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 25 && this._currentframe != 30 && this._currentframe != 55 && this._currentframe != 60 && this._currentframe != 65 && this._currentframe != 70)
  22.          {
  23.             _xscale = scale;
  24.             speed++;
  25.             _global.faceright = 1;
  26.             _global.faceleft = 0;
  27.             if(speed >= maxspeed)
  28.             {
  29.                speed = maxspeed;
  30.             }
  31.             if(_root.ground.hitTest(_X,_Y + 7,true))
  32.             {
  33.                this.gotoAndStop("run");
  34.             }
  35.          }
  36.          else if(Key.isDown(_global.leftkey) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 25 && this._currentframe != 30 && this._currentframe != 55 && this._currentframe != 60 && this._currentframe != 65 && this._currentframe != 70)
  37.          {
  38.             _xscale = - scale;
  39.             speed--;
  40.             _global.faceleft = 1;
  41.             _global.faceright = 0;
  42.             if(speed <= maxspeed * -1)
  43.             {
  44.                speed = maxspeed * -1;
  45.             }
  46.             if(_root.ground.hitTest(_X,_Y + 7,true))
  47.             {
  48.                this.gotoAndStop("run");
  49.             }
  50.          }
  51.          else
  52.          {
  53.             if(speed > 0)
  54.             {
  55.                speed--;
  56.                if(speed <= 0)
  57.                {
  58.                   speed = 0;
  59.                }
  60.             }
  61.             else if(speed < 0)
  62.             {
  63.                speed++;
  64.                if(speed >= 0)
  65.                {
  66.                   speed = 0;
  67.                }
  68.             }
  69.             if(_root.ground.hitTest(_X,_Y + 3,true) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 25 && this._currentframe != 30 && this._currentframe != 50 && this._currentframe != 55 && this._currentframe != 60 && this._currentframe != 65 && this._currentframe != 70)
  70.             {
  71.                this.gotoAndStop("idle");
  72.             }
  73.          }
  74.          spike = 0;
  75.          if(this.hitboxLevel.hitTest(_root.spike1.beg) && _root.spike1.beg._currentframe == 1 && !spike)
  76.          {
  77.             _root.spike1.gotoAndPlay(2);
  78.             if(_global.sounds == 1)
  79.             {
  80.                spike = new Sound(this);
  81.                spike.attachSound("spike");
  82.                spike.start();
  83.                spike = 1;
  84.             }
  85.             else
  86.             {
  87.                spike = 0;
  88.             }
  89.          }
  90.          if(this.hitboxLevel.hitTest(_root.spike1.hitbox) && this._currentframe != 15 && this._currentframe != 20)
  91.          {
  92.             this.gotoAndStop("damage_1");
  93.             _root.camera.health.nextFrame();
  94.          }
  95.          if(this.hitboxLevel.hitTest(_root.spike2.beg) && _root.spike2.beg._currentframe == 1 && !spike)
  96.          {
  97.             _root.spike2.gotoAndPlay(2);
  98.             if(_global.sounds == 1)
  99.             {
  100.                spike = new Sound(this);
  101.                spike.attachSound("spike");
  102.                spike.start();
  103.                spike = 1;
  104.             }
  105.             else
  106.             {
  107.                spike = 0;
  108.             }
  109.             if(this.hitboxLevel.hitTest(_root.spike2.hitbox) && this._currentframe != 15 && this._currentframe != 20)
  110.             {
  111.                this.gotoAndStop("damage_1");
  112.                _root.camera.health.nextFrame();
  113.             }
  114.          }
  115.          if(Key.isDown(p || esc) && !paus3)
  116.          {
  117.             _root.pauseMenu.gotoAndStop(5);
  118.             _root.paus3 = 1;
  119.          }
  120.          if(Key.isDown(_global.upkey) && _root.ground.hitTest(_X,_Y + 7,true) || _root.ground2.hitTest(_X,_Y + 7,true) && grav <= 4)
  121.          {
  122.             grav = - jumpHeight;
  123.             _Y = _Y - 4;
  124.             this.gotoAndStop("jump");
  125.             if(_root.sfxjc._currentframe <= 20)
  126.             {
  127.                _root.sfx.gotoAndPlay("jump1");
  128.             }
  129.             if(_root.sfxjc._currentframe >= 20)
  130.             {
  131.                _root.sfx.gotoAndPlay("jump2");
  132.             }
  133.          }
  134.          attackFrame = ["attack_1","attack_2","attack_4","attack_5"];
  135.          attack = 0;
  136.          if(!Key.isDown(_global.rightkey) && !Key.isDown(_global.leftkey) && !Key.isDown(_global.upkey) && !jumping && !attack)
  137.          {
  138.             if(this._currentframe != 10 && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 55 && this._currentframe != 60 && this._currentframe != 65 && this._currentframe != 70)
  139.             {
  140.                if(Key.isDown(_global.z) || Key.isDown(_global.spc))
  141.                {
  142.                   _root.char.gotoAndStop(attackFrame[random(attackFrame.length)]);
  143.                   attack = 1;
  144.                }
  145.                if(Key.isDown(88))
  146.                {
  147.                   this.gotoAndStop("attack_3");
  148.                }
  149.                if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box) && _root.box._currentframe != 10 && this._currentframe != 40)
  150.                {
  151.                   _root.char.gotoAndStop("kick");
  152.                   attack = 1;
  153.                }
  154.                if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box2) && _root.box2._currentframe != 10 && this._currentframe != 40)
  155.                {
  156.                   _root.char.gotoAndStop("kick");
  157.                   attack = 1;
  158.                }
  159.                if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box3) && _root.box3._currentframe != 10 && this._currentframe != 40)
  160.                {
  161.                   _root.char.gotoAndStop("kick");
  162.                   attack = 1;
  163.                }
  164.                if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box4) && _root.box4._currentframe != 10 && this._currentframe != 40)
  165.                {
  166.                   _root.char.gotoAndStop("kick");
  167.                   attack = 1;
  168.                }
  169.             }
  170.             if(this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40)
  171.             {
  172.                attack = 0;
  173.             }
  174.          }
  175.          if(!attack && this._currentframe != 10 && this._currentframe != 50 && this._currentframe != 15 && this._currentframe != 40 && _root.camera.specialBar._currentframe == 5 && !Key.isDown(_global.rightkey) && !Key.isDown(_global.leftkey))
  176.          {
  177.             if(Key.isDown(_global.a))
  178.             {
  179.                this.gotoAndStop("special");
  180.                attack = 1;
  181.                _root.camera.specialBar.gotoAndStop(1);
  182.                _global.fucker = 0;
  183.             }
  184.          }
  185.       }
  186.       tuska = 25;
  187.       i = 1;
  188.       while(i <= tuska)
  189.       {
  190.          tusk = _root["tusk" + i];
  191.          if(this.hitTest(tusk))
  192.          {
  193.             tusk.gotoAndStop(7);
  194.             _global.score += 1;
  195.             if(_global.sounds == 1)
  196.             {
  197.                tuskPickup = new Sound(this);
  198.                tuskPickup.attachSound("tuskPickup");
  199.                tuskPickup.start();
  200.             }
  201.          }
  202.          i++;
  203.       }
  204.       tuskb = 25;
  205.       i = 1;
  206.       while(i <= tuskb)
  207.       {
  208.          clump = _root["clump" + i];
  209.          if(this.hitTest(clump))
  210.          {
  211.             clump.gotoAndStop(10);
  212.             _global.score += 5;
  213.             if(_global.sounds == 1)
  214.             {
  215.                tuskPickup = new Sound(this);
  216.                tuskPickup.attachSound("tuskPickup");
  217.                tuskPickup.start();
  218.             }
  219.          }
  220.          i++;
  221.       }
  222.       wallsLeft = 20;
  223.       i = 1;
  224.       while(i <= wallsLeft)
  225.       {
  226.          wallLeft = _root["wallLeft" + i];
  227.          if(Key.isDown(37))
  228.          {
  229.             if(wallLeft.hitTest(_X + _width / 2 + ex,_Y - _height / 2,true) || wallLeft.hitTest(_X + _width / 2 + ex,_Y - _height / 6,true) || wallLeft.hitTest(_X + _width / 2 + ex,_Y - _height,true))
  230.             {
  231.                speed = 0;
  232.             }
  233.          }
  234.          i++;
  235.       }
  236.       wallsRight = 20;
  237.       i = 1;
  238.       while(i <= wallsRight)
  239.       {
  240.          wallRight = _root["wallRight" + i];
  241.          if(Key.isDown(39))
  242.          {
  243.             if(wallRight.hitTest(_X + _width / 2 + ex,_Y - _height / 2,true) || wallRight.hitTest(_X + _width / 2 + ex,_Y - _height / 6,true) || wallRight.hitTest(_X + _width / 2 + ex,_Y - _height,true))
  244.             {
  245.                speed = 0;
  246.             }
  247.          }
  248.          i++;
  249.       }
  250.       blubbers = 5;
  251.       i = 1;
  252.       while(i <= blubbers)
  253.       {
  254.          blubber = _root["blubber" + i];
  255.          if(blubber.hitTest(_X,_Y,true) && blubber._currentframe != 1)
  256.          {
  257.             grav = (- jumpHeight) * 2.8;
  258.             blubber.gotoAndStop(10);
  259.             bounce = new Sound(this);
  260.             bounce.attachSound("bounce");
  261.             if(_global.sounds == 1)
  262.             {
  263.                bounce.start();
  264.             }
  265.          }
  266.          i++;
  267.       }
  268.       if(_root.boat.hitTest(_X,_Y,true))
  269.       {
  270.          grav = - jumpHeight;
  271.          bounce = new Sound(this);
  272.          bounce.attachSound("bounce");
  273.          if(_global.sounds == 1)
  274.          {
  275.             bounce.start();
  276.          }
  277.       }
  278.       if(this.hitTest(_root.bridgeHit))
  279.       {
  280.          _root.bridge.gotoAndStop(5);
  281.          _root.ground.gotoAndStop(5);
  282.       }
  283.       if(this.hitTest(_root.key1))
  284.       {
  285.          _root.key1.gotoAndStop(2);
  286.          _root.blubber1.gotoAndStop(5);
  287.          _root.camera.textBlubber.gotoAndStop(2);
  288.          keySound = new Sound(this);
  289.          keySound.attachSound("keySound");
  290.          if(_global.sounds == 1)
  291.          {
  292.             keySound.start();
  293.          }
  294.       }
  295.       if(this.hitTest(_root.key2))
  296.       {
  297.          _root.key2.gotoAndStop(2);
  298.          _root.blubber2.gotoAndStop(5);
  299.          _root.camera.textBlubber.gotoAndStop(2);
  300.          keySound = new Sound(this);
  301.          keySound.attachSound("keySound");
  302.          if(_global.sounds == 1)
  303.          {
  304.             keySound.start();
  305.          }
  306.       }
  307.       if(this.hitTest(_root.key3))
  308.       {
  309.          _root.key3.gotoAndStop(2);
  310.          _root.blubber4.gotoAndStop(5);
  311.          _root.camera.textBlubber.gotoAndStop(2);
  312.          keySound = new Sound(this);
  313.          keySound.attachSound("keySound");
  314.          if(_global.sounds == 1)
  315.          {
  316.             keySound.start();
  317.          }
  318.       }
  319.       if(this.hitTest(_root.fall))
  320.       {
  321.          _root.gotoAndStop("death");
  322.       }
  323.       bears = 10;
  324.       i = 1;
  325.       while(i <= bears)
  326.       {
  327.          bear = _root["bear" + i];
  328.          if(this.attack_1.attackHit.hitTest(bear.hit) && bear._currentframe != 15)
  329.          {
  330.             bear.gotoAndStop("death");
  331.             _global.kills += 1;
  332.          }
  333.          if(this.attack_2.attackHit.hitTest(bear.hit) && bear._currentframe != 15)
  334.          {
  335.             bear.gotoAndStop("death");
  336.             _global.kills += 1;
  337.          }
  338.          if(this.attack_3.attackHit.hitTest(bear.hit) && bear._currentframe != 15)
  339.          {
  340.             bear.gotoAndStop("death");
  341.             _global.kills += 1;
  342.          }
  343.          if(this.attack_4.attackHit.hitTest(bear.hit) && bear._currentframe != 15)
  344.          {
  345.             bear.gotoAndStop("death");
  346.             _global.kills += 1;
  347.          }
  348.          if(this.attack_5.attackHit.hitTest(bear.hit) && bear._currentframe != 15)
  349.          {
  350.             bear.gotoAndStop("death");
  351.             _global.kills += 1;
  352.          }
  353.          if(bear.attack_1.hit.hitTest(this.hitboxLevel) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 25 && this._currentframe != 45 && this._currentframe != 50 && this._currentframe != 55 && this._currentframe != 60 && this._currentframe != 65 && this._currentframe != 70)
  354.          {
  355.             this.gotoAndStop("damage_1");
  356.             _root.camera.health.nextFrame();
  357.          }
  358.          i++;
  359.       }
  360.       eagles = 10;
  361.       i = 1;
  362.       while(i <= eagles)
  363.       {
  364.          eagle = _root["eagle" + i];
  365.          if(this.attack_1.attackHit.hitTest(eagle.hit) && eagle._currentframe != 5)
  366.          {
  367.             eagle.gotoAndStop(5);
  368.             _global.kills += 1;
  369.          }
  370.          if(this.attack_2.attackHit.hitTest(eagle.hit) && eagle._currentframe != 5)
  371.          {
  372.             eagle.gotoAndStop(5);
  373.             _global.kills += 1;
  374.          }
  375.          if(this.attack_3.attackHit.hitTest(eagle.hit) && eagle._currentframe != 5)
  376.          {
  377.             eagle.gotoAndStop(5);
  378.             _global.kills += 1;
  379.          }
  380.          if(this.attack_4.attackHit.hitTest(eagle.hit) && eagle._currentframe != 5)
  381.          {
  382.             eagle.gotoAndStop(5);
  383.             _global.kills += 1;
  384.          }
  385.          if(this.attack_5.attackHit.hitTest(eagle.hit) && eagle._currentframe != 5)
  386.          {
  387.             eagle.gotoAndStop(5);
  388.             _global.kills += 1;
  389.          }
  390.          i++;
  391.       }
  392.       mooses = 10;
  393.       i = 1;
  394.       while(i <= mooses)
  395.       {
  396.          moose = _root["moose" + i];
  397.          if(moose.attack.hit.hitTest(this.hitboxLevel))
  398.          {
  399.             if(_global.faceleft)
  400.             {
  401.                this._x += 10;
  402.                if(this._currentframe != 70)
  403.                {
  404.                   this.gotoAndStop("knockdown");
  405.                   _root.camera.health.nextFrame();
  406.                }
  407.             }
  408.             else if(_global.faceright)
  409.             {
  410.                this._x -= 10;
  411.                if(this._currentframe != 70)
  412.                {
  413.                   this.gotoAndStop("knockdown");
  414.                   _root.camera.health.nextFrame();
  415.                }
  416.             }
  417.          }
  418.          i++;
  419.       }
  420.       if(_root.ground.hitTest(_X + _width / 2 + ex,_Y - _height / 4,false) || _root.ground.hitTest(_X + _width / 2 + ex,_Y - _height / 12,false) || _root.ground.hitTest(_X + _width / 4 + ex,_Y - _height,false))
  421.       {
  422.          _X = _X - speed;
  423.       }
  424.       if(_root.ground.hitTest(_X - _width / 2 - ex,_Y - _height / 4,false) || _root.ground.hitTest(_X - _width / 2 - ex,_Y - _height / 12,false) || _root.ground.hitTest(_X - _width / 4 - ex,_Y - _height,false))
  425.       {
  426.          _X = _X + speed;
  427.       }
  428.       if(grav >= 5)
  429.       {
  430.          this.gotoAndStop("fall2");
  431.       }
  432.    }
  433. }
  434.